﻿//-----------------------------------------------------------------------
// <copyright file="AuctioneerTests.cs" company="Transilvania University of Brasov">
//     Copyright (c) Nagy Robert. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace TestDomainModel
{
    using DomainModel;
    using Microsoft.Practices.EnterpriseLibrary.Validation;
    using NUnit.Framework;

    /// <summary>
    /// Tests for the Auctioneer class
    /// </summary>
    [TestFixture]
    public class AuctioneerTests
    {
        /// <summary>
        /// Gets the valid auctioneer.
        /// </summary>
        private Auctioneer ValidAuctioneer
        {
            get
            {
                return new Auctioneer
                {
                    FirstName = "FirstName",
                    LastName = "LastName",
                    Id = 1,
                    Password = "Password",
                    Rating = 5,
                    Username = "Username"
                };
            }
        }

        /// <summary>
        /// Tests the identifier should not be less than one.
        /// </summary>
        /// <param name="id">The identifier.</param>
        [Test]
        public void TestIdShouldNotBeLessThanOne([Values(-10, 0)] int id)
        {
            Auctioneer auctioneer = this.ValidAuctioneer;
            auctioneer.Id = id;

            ValidationResults validationResults = Validation.Validate(auctioneer);
            Assert.IsFalse(validationResults.IsValid);
        }

        /// <summary>
        /// Tests the identifier should be greater than zero.
        /// </summary>
        /// <param name="id">The identifier.</param>
        [Test]
        public void TestIdShouldBeGreaterThanZero([Values(1, 10)] int id)
        {
            Auctioneer auctioneer = this.ValidAuctioneer;
            auctioneer.Id = id;

            ValidationResults validationResults = Validation.Validate(auctioneer);
            Assert.IsTrue(validationResults.IsValid);
        }
    }
}
